﻿@{
    Layout = "~/Views/Shared/OA/_Index.cshtml";
}
@section Toolbar
{
    @Html.MyNet().Button(new ButtonOptions { Text = "确定", Click = "choose", })

}
@section Menu
{
    @Html.MyNet().Button(new ButtonOptions { Text = "确定", Click = "choose" })
}
@section Query
{
    @Html.Partial("_Query", new UserCondition())
}
@section Main
{
    <div id="grid" class="grid">
    </div>
    <div id="pager" class="pager">
    </div>
}
@Html.Hidden("ForApplication", Request["Application"])
@Html.Hidden("RoleId", Request["RoleId"])
@Html.Hidden("HasRole", Request["HasRole"])

<script>

    var application = $("#ForApplication").val();
    var roleId = $("#RoleId").val();
    var hasRole = $("#HasRole").val();

    var url = "/Common/User/";

    jQuery(function () {
        read();
    });

    function read() {
        query.application = application;
        query.roleId = roleId;
        query.hasRole = hasRole;

        $.ajax
        ({
            url: url + "Read",
            data: query,
            type: "post",
            error: disposeError,
            success: function (result) {
                if (disposeException(result)) return;
                bind(result);
            }
        });
    }


    function choose() {
        if (!gridSelected()) return alert("未选中任何数据！");
        var data = { id: gridSelected()[0], userName: gridSelectedHidden("UserName")[0] };
        top.callback(data);
        if (typeof (isClose) != 'undefined' && isClose == false) {
            return;
        }
        top.winClose();
    }

</script>
